# -*- coding = utf-8 -*-
# @Time : 2021/12/21 11:59
# @Author : 龙王赘婿_彪少
# @File : demo07.py
# @Software: PyCharm

# 状态栏，菜单栏，工具栏

import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QAction, QApplication, qApp


class Example(QMainWindow):
    def __init__(self):
        super(Example, self).__init__()
        self.init_menubar()
        self.init_statusbar()
        self.init_toolbar()
        self.SHOW()

    def init_statusbar(self):
        self.statusBar().showMessage("ready")

    def init_menubar(self):
        self.exitAction = QAction("Exit", self)
        self.exitAction.setShortcut("Ctrl+Q")
        self.exitAction.setStatusTip("Exit application")
        # 手册里说 qApp 就是 QCoreApplication::instance()
        self.exitAction.triggered.connect(qApp.quit)

        self.statusBar()

        # 菜单对象
        menubar = self.menuBar()
        # 菜单
        fileMenu = menubar.addMenu("File")
        fileMenu.addAction(self.exitAction)

        editMenu = menubar.addMenu("Edit")

    def init_toolbar(self):
        toolbar = self.addToolBar("Exit")
        toolbar.addAction(self.exitAction)

    def SHOW(self):
        self.setGeometry(300, 300, 250, 150)
        self.setWindowTitle("Title")
        self.show()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())
